package com.softstao.guoyu.mvp.presenter.me;

import com.softstao.guoyu.model.me.MeToOtherList;
import com.softstao.guoyu.model.me.OtherToMeList;
import com.softstao.guoyu.model.me.RebateCondition;
import com.softstao.guoyu.model.me.RebateDetail;
import com.softstao.guoyu.model.me.ProvinceRebate;
import com.softstao.guoyu.mvp.interactor.me.RebateInteractor;
import com.softstao.guoyu.mvp.presenter.BasePresenter;
import com.softstao.guoyu.mvp.viewer.BaseViewer;
import com.softstao.guoyu.mvp.viewer.me.MeToOtherListViewer;
import com.softstao.guoyu.mvp.viewer.me.OtherToMeListViewer;
import com.softstao.guoyu.mvp.viewer.me.ProvinceRebateViewer;
import com.softstao.guoyu.mvp.viewer.me.RebateDetailViewer;

/**
 * Created by vaikus on 2017/7/20.
 */

public class RebatePresenter extends BasePresenter<BaseViewer,RebateInteractor> {
    public void getProvinceRebate(int agentId,String month){
        interactor.getProvinceRebate(agentId,month,o -> ((ProvinceRebateViewer)viewer).getProvinceRebate((ProvinceRebate) o));
    }

    public void getOtherToMeList(int page,int agentId,String month){
        interactor.getOtherToMeList(page,agentId,month,o -> ((OtherToMeListViewer)viewer).getOtherToMeList((OtherToMeList) o));
    }

    public void getMeToOtherList(int page,int agentId,String month){
        interactor.getMeToOtherList(page,agentId,month,o -> ((MeToOtherListViewer)viewer).getMeToOtherList((MeToOtherList) o));
    }

    public void getDetail(int page,int type, RebateCondition condition){
        switch (type){
            case 1:
                interactor.getOtherToMeDetail(page,condition,o -> ((RebateDetailViewer)viewer).getDetail((RebateDetail) o));
                break;
            case 2:
                interactor.getMeToOtherDetail(page,condition,o -> ((RebateDetailViewer)viewer).getDetail((RebateDetail) o));
                break;
        }
    }
}
